package {
	import event.GameEvent;
	import flash.display.Sprite;
	import flash.events.Event;
	import model.ai.GameNode;
	import model.GameData;
	
	/**
	 * ...
	 * @author flyingSnow
	 */
	public class AiModuleMain extends Sprite {
		
		public function AiModuleMain():void {
			//if (stage) init();
			//else addEventListener(Event.ADDED_TO_STAGE, init);
		}
		
		private function init(e:Event = null):void {
			//removeEventListener(Event.ADDED_TO_STAGE, init);
			// entry point
		}
		public function send2Ai(gameData:GameData):void {
			var rootNode:GameNode = new GameNode();
			rootNode.consideringPlayer = gameData.crntPlayerIndex;
			rootNode.gameData = gameData;
			
			var score:int = rootNode.score;
			var bestPath:Object = rootNode.bestChildPath;
trace(score);			
			var resultEvent:GameEvent = new GameEvent(GameEvent.BEST_PATH, true);
			resultEvent.args = { bestPath:bestPath };
			dispatchEvent(resultEvent);
		}
	}
	
}